/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package puntoventa.modelo;

import puntoventa.modelo.Rolesformularios;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author infor
 */
@Entity
@Table(name = "roles", catalog = "pv", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Roles.findAll", query = "SELECT r FROM Roles r"),
    @NamedQuery(name = "Roles.findByIdRoles", query = "SELECT r FROM Roles r WHERE r.idRoles = :idRoles"),
    @NamedQuery(name = "Roles.findByNombreRoles", query = "SELECT r FROM Roles r WHERE r.nombreRoles = :nombreRoles")})
public class Roles implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_roles")
    private Integer idRoles;
    @Column(name = "nombre_roles")
    private String nombreRoles;
    @OneToMany(mappedBy = "idRoles")
    private List<Rolesformularios> rolesformulariosList;

    public Roles() {
    }

    public Roles(Integer idRoles) {
        this.idRoles = idRoles;
    }

    public Integer getIdRoles() {
        return idRoles;
    }

    public void setIdRoles(Integer idRoles) {
        Integer oldIdRoles = this.idRoles;
        this.idRoles = idRoles;
        changeSupport.firePropertyChange("idRoles", oldIdRoles, idRoles);
    }

    public String getNombreRoles() {
        return nombreRoles;
    }

    public void setNombreRoles(String nombreRoles) {
        String oldNombreRoles = this.nombreRoles;
        this.nombreRoles = nombreRoles;
        changeSupport.firePropertyChange("nombreRoles", oldNombreRoles, nombreRoles);
    }

    public List<Rolesformularios> getRolesformulariosList() {
        return rolesformulariosList;
    }

    public void setRolesformulariosList(List<Rolesformularios> rolesformulariosList) {
        this.rolesformulariosList = rolesformulariosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRoles != null ? idRoles.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Roles)) {
            return false;
        }
        Roles other = (Roles) object;
        if ((this.idRoles == null && other.idRoles != null) || (this.idRoles != null && !this.idRoles.equals(other.idRoles))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "puntoventa.formulario.Roles[ idRoles=" + idRoles + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
